package org.jeecg.modules.bobo.common.service.impl;

import org.jeecg.modules.bobo.common.entity.LbDict;
import org.jeecg.modules.bobo.common.entity.LbDictItem;
import org.jeecg.modules.bobo.common.mapper.LbDictItemMapper;
import org.jeecg.modules.bobo.common.mapper.LbDictMapper;
import org.jeecg.modules.bobo.common.service.ILbDictService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import java.io.Serializable;
import java.util.List;
import java.util.Collection;

/**
 * @Description: 字典
 * @Author: jeecg-boot
 * @Date:   2020-11-24
 * @Version: V1.0
 */
@Service
public class LbDictServiceImpl extends ServiceImpl<LbDictMapper, LbDict> implements ILbDictService {

	@Autowired
	private LbDictMapper lbDictMapper;
	@Autowired
	private LbDictItemMapper lbDictItemMapper;
	
	@Override
	@Transactional
	public void delMain(String id) {
		lbDictItemMapper.deleteByMainId(id);
		lbDictMapper.deleteById(id);
	}

	@Override
	@Transactional
	public void delBatchMain(Collection<? extends Serializable> idList) {
		for(Serializable id:idList) {
			lbDictItemMapper.deleteByMainId(id.toString());
			lbDictMapper.deleteById(id);
		}
	}
	
}
